#include <REGX52.H>

typedef  unsigned char u8_t;

code unsigned char Num[] = {0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};

void Delay(int ms)	//@11.0592MHz
{
	unsigned char data i, j;

	while(ms--)
	{
		i = 2;
		j = 199;
		do
		{
			while (--j);
		} while (--i);
	}

}




void show(u8_t wei,u8_t num)
{
	
	switch(wei)
	{
		case 1:
			P2_2 = 0;P2_3 = 0;P2_4 = 0;P0 = Num[num];break;
		case 2:
			P2_2 = 1;P2_3 = 0;P2_4 = 0;P0 = Num[num];break;
		case 3:
			P2_2 = 0;P2_3 = 1;P2_4 = 0;P0 = Num[num];break;
		case 4:
			P2_2 = 1;P2_3 = 1;P2_4 = 0;P0 = Num[num];break;
		case 5:
			P2_2 = 0;P2_3 = 0;P2_4 = 1;P0 = Num[num];break;
		case 6:
			P2_2 = 1;P2_3 = 0;P2_4 = 1;P0 = Num[num];break;
		case 7:
			P2_2 = 0;P2_3 = 1;P2_4 = 1;P0 = Num[num];break;
		case 8:
			P2_2 = 1;P2_3 = 1;P2_4 = 1;P0 = Num[num];break;
	}
	Delay(1);
	P0 = 0x00;	
}

void main()
{
	
	while(1)
	{
		show(8,8);
		show(7,7);
		show(6,6);
		show(5,5);
		show(4,4);
		show(3,3);
		show(2,2);
		show(1,1);
	}

}

